package democlone;

public class Person implements Cloneable{
    int age;
    Person(int age) {
        this.age = age;
    }

    public Money m = new Money();

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Person tmp = (Person)super.clone();
        tmp.m = (Money)this.m.clone();
        return tmp;
    }

    @Override
    public String toString() {
        return "Person{" +
                "age=" + age +
                ", m=" + m+
                '}';
    }
}
